import { Service } from "cl-admin";
import BaseService from "@/service/base";
@Service("homeOnSale")
class PreSale extends BaseService {
	getParams({ dateArr, ...args }) {
		return { ...args, year: dateArr?.[0] || '', month: dateArr?.[1] || '' }
	}
	// 头部卡片
	topCards(query) {
		let params = this.getParams(query)
		return this.$get("/topCards", { params });
	}
	// 每月走势图
	monthTrend(query) {
		let params = this.getParams(query)
		return this.$get("/monthTrend", { params });
	}
	// 部门业绩排行
	deptRanking(query) {
		let params = this.getParams(query)
		return this.$get("/deptRanking", { params });
	}
	// 单部门业绩详情
	getDeptMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getDeptMonthData", { params });
	}
	// 组员业绩排行
	deptUserRanking(query) {
		let params = this.getParams(query)
		return this.$get("/deptUserRanking", { params });
	}
	// 组员每月业绩明细
	getUserMonthData(query) {
		let params = this.getParams(query)
		return this.$get("/getUserMonthData", { params });
	}
	// 业绩之星top10
	getAchieveTop10(query) {
		let params = this.getParams(query)
		return this.$get("/getAchieveTop10", { params });
	}
	// 到店之星top10
	getArriveTop10(query) {
		let params = this.getParams(query)
		return this.$get("/getArriveTop10", { params });
	}
	// 转化之星top10
	getArriveRatioTop10(query) {
		let params = this.getParams(query)
		return this.$get("/getArriveRatioTop10", { params });
	}
	// 潜力之星top10
	getOutputRatioTop10(query) {
		let params = this.getParams(query)
		return this.$get("/getOutputRatioTop10", { params });
	}

	// 清除缓存
	clearCache(query) {
		let params = this.getParams(query)
		return this.$get('/clearCache', { params })
	}
}

export default PreSale;
